{#**
*
* 功能描述（代金券列表模板）
*
* @author suoya <jlusuoya@gmail.com>
* @version 1
*#}
{#if isset($g_ext) && isset($g_ext['print'])#}
    {#include file="baseheader.tpl"#}
    <style>
        table {
            border-collapse:collapse;
            margin: 20px;
        }
        td {
            border:1px solid #000000;
        }
    </style>
    {#foreach $listdata as $item#}
        <table>
            <tbody>
                <tr><td>NO: {#$item['no']#}</td><td>梵地蛋糕(示例)</td></tr>
                <tr>
                    <td>金额:{#$item['amount']#}</td>
                    <td>过期时间：{#$item['outtime']#}</td>
                </tr>
            </tbody>
        </table>
    {#/foreach#}
    <script> window.onload = function() {
            window.print();
        }</script>
        {#include file="basefooter.tpl"#}
    {#else#}
        {#include file="header.tpl" title="title" active="voucher" #}
        {#include file="define.tpl" scope=parent#}
    <div class="content  middle">
        <div class="ui breadcrumb">
            <a class="section" href="index.php">主页</a>
            <i class="right"></i>
            <span class="active section">代金券管理</span>
        </div>
        <script language="javascript" type="text/javascript" src="js/My97DatePicker/WdatePicker.js"></script>
        {#include file="search_bar_v2.tpl"
		s_basic = [
			'status'=>[0, '状态：', $v_sta]
		]
		s_vdate=['u_start'=>'使用日期：', 'u_end'=>'--&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;']
		s_keys=['prefix' => '前缀', 'no'=>'序列号', 'amount'=>'金额', 'adm_id' => '管理员ID', 'user_id'=>'使用账号ID']#}
        <div class="search">
            <div class="searchTitle">
                添加代金卷
            </div>
            <div class="searchBar">
                <form action="index.php?action=voucher.create" method="POST" onsubmit="ajax_commit(this);
                        return false" style='margin: 5px;'>
                    <label>6位前缀：</label><input name="prefix" value="FDDJQ1" class="input_text" style="width: 60px;"/>
                    <label class="date_search_label">金额：</label><input name="amount" value="10" class="input_text" style="width: 100px;" />
                    <label class="date_search_label">总数：</label><input name="cnt" value="10" class="input_text" style="width: 60px;" />
                    <label class="date_search_label">过期时间：</label><input name="outtime" value="" onclick="WdatePicker({dateFmt: 'yyyy-MM-dd HH:mm:ss', minDate: '{#$cur_time#}'})" class="input_text" readonly="readonly" style="width: 150px;" />
                    <input type="submit" value="添加" class="button align_right" />
                </form>
            </div>
        </div>
        <div class="button_bar">
            <button onclick="ajax_call(window.location.href+'&setsta=3')" class="button align_right">下发筛选</button>
            <button name="excel_page" class="button align_right">导出筛选为EXEL2007</button>
            <button name="print_page" class="button align_right">打印本页</button>
        </div>
        <table class="ui table segment">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>序列号</th>
                    <th>金额</th>
                    <th>使用金额</th>
                    <th>生成时间</th>
                    <th>过期时间</th>
                    <th>操作员</th>
                    <th>使用时间</th>
                    <th>用户ID</th>
                    <th>订单ID</th>
                    <th>状态</th>
                </tr>
            </thead>
            <tbody>
                {#foreach $listdata as $item#}
                    <tr>
                        <td>{#$item['id']#}</td>
                        <td>{#$item['no']#}</td>
                        <td>{#$item['amount']#}</td>
                        <td>{#$item['amount_use']#}</td>
                        <td>{#$item['createtime']#}</td>
                        <td>{#$item['outtime']#}</td>
                        <td><a href="#" onclick="return showadm({#$item['adm_id']#})">ID {#$item['adm_id']#}</a></td>
                        <td>{#if $item['usetime'] != '0000-00-00 00:00:00'#}{#$item['usetime']#}{#/if#}</td>
                        <td>{#if $item['user_id'] != 0#}<a href="#" onclick="return showuser({#$item['user_id']#})">ID {#$item['user_id']#}</a>{#/if#}</td>
                        <td>{#if $item['order_id'] != 0#}{#$item['order_id']#}{#/if#}</td>
                        <td>{#$v_sta[$item['status']]#}</td>
                    </tr>
                {#/foreach#}
            </tbody>

            <tfoot>
                <tr>
                    <th colspan="11" style="font-style: normal;">
                        {#include file="paging_bar.tpl"#}
                    </th>
                </tr>
            </tfoot>
        </table>
    </div>
    {#include file="footer.tpl" #}
{#/if#}
